﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.Web.Profile;

namespace Dragon.Prototype1.Service
{
    public class UserProfile
    {
        public static void SaveUserId(string userName)
        {
            ProfileBase profile = ProfileBase.Create(userName, true);
            MembershipUser user = Membership.GetUser(userName);
            profile.SetPropertyValue("UserId", user.ProviderUserKey.ToString());
            profile.Save();
        }

        public static Guid GetUserId(string userName)
        {
            ProfileBase profile = ProfileBase.Create(userName, true);
            return new Guid((string)profile.GetPropertyValue("UserId"));
        }
    }
}
